package com.gqb.deleteFileService;

import java.io.File;
import java.io.IOException;

public class TestDelete {
	public static void main(String[] args) {
		final DeleteFileService deleteFileService=DeleteFileService.getInstance();
		final String pathString="d:/file/";
		Thread addFileThread=new Thread(new Runnable() {
			
			@Override
			public void run() {
				int i=1;
				while(true){
					i++;
					String path=pathString+i+'/'+i+".txt";
					File file=new File(path);
					
					try {
						file.getParentFile().mkdirs();
						file.createNewFile();
						Thread.sleep(400);
						deleteFileService.deleteFile(file.getPath());
					} catch (InterruptedException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} catch (IOException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			}
		});
		addFileThread.run();
	}
}
